<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');

/**
 * Init Model
 *
 */


class Browse_model extends CI_Model {

	function __construct(){
		parent::__construct();
	}
	
	
	public function getAll($featured=0,$alpha='All',$perpage=10,$offset=0,$limit=10)
	{
	
			
	
	
		if($alpha =='All'){
			$sql = "select * from profile where status=51 ORDER BY title DESC limit $limit";
		}else{
			$sql = "select * from profile WHERE title LIKE '$alpha%' and status=51 ORDER BY title DESC  limit $offset, $limit";
		}
		if($featured==1){
			$sql = "select * from profile where featured=1 status=51 limit $limit";
		}
	
		$query = $this->db->query($sql);
		$result = $query->result();
	
		return $result;
	
	}
	
	
	//--Active pagination -- rahul sinha--//
	function count_all_business($tblname='') {
		if ($tblname) {
			$sql = "Select count(*)as total from $tblname ";
			$query = $this->db->query($sql);
			$row = $query->row();
			if ($row->total != 0)
				return $row->total;
			else
				return 0;
		}else {
			return 0;
		}
	}
}